<?php

namespace Api;
use Product,Response;

class ProductsController extends \BaseController {

	/**
	 * Display a listing of products
	 *
	 * @return Response
	 */
	public function index()
	{
		$products = Product::whereStatus(1)->get(['id', 'title', 'intro', 'thumbnail'])->toArray();

        return Response::json(['data' => $products], 200);
	}

	/**
	 * Display the specified product.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($id)
	{
		$product = Product::findOrFail($id);

		return $product;
	}

}
